package com.itheima.controller;

import com.itheima.common.R;
import com.itheima.pojo.OrdersPage;
import com.itheima.service.OrdersService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Date;

/**
 * @author Envy
 */
@RestController
@RequestMapping("/order")
public class OrdersController {
    @Resource
    OrdersService ordersService;

    /**
     * 分页查询
     */
    @GetMapping("/page")
    public R<OrdersPage> ordersPage(Date beginTime, Date endTime, String number, Integer page, Integer pageSize) {
        Integer pageMin = (page - 1) * pageSize;
        return ordersService.ordersPage(beginTime, endTime, number, pageMin, pageSize);
    }
}
